<?php namespace App\Controllers;
use CodeIgniter\Controller;
use CodeIgniter\I18n\Time;




    class Pages extends BaseController 
    {
    protected $logic1;
    protected $logic2;
    protected $myTime;

				 public function __construct() 
				    {
						parent::__construct();
						$this->myTime = parent::getTime();
						$this->myDate= date("d/m/Y",$this->myTime); 	
					
			       }


    			public function index()
				{
					
					 echo $this->request->getVar('title');
					//return view('welcome_message');
				}

						public function showme($page = 'home')
					    {
							$this->cachePage(DAY);
							
							
							$this->logic1=	file_exists(APPPATH.'/Views/'.$page.'.php');
								
											if(( $this->logic1 == NUll)OR ($this->logic1 == False))
											
											{
											
											return redirect('noPage');
											
												
										   }														
											elseif(($this->logic1==1)OR($this->logic1==true))
											{
												
												$data = [
														'title'  =>ucfirst($page)	 ,
														'date'=>$this->myDate
												];
												
																			
										
										
											echo view($page,$data);
											
											
										
									}
									
									
									
										
										
										}	
												
												
						
					
			
    public function nopage()
    {
    $this->cachePage(DAY);
	
	$data = [
                'title'  => 'no page',
               //'result2'=>$result
	       //above works
	       
	       'date'=>$this->myDate
	       
	       
	       
	       
        ];

     
        echo view('noPage',$data);
       
	
   
   
   
   
    }
    
 }   
    
    
    
    
